<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" display="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" display="IE=edge,chrome=1">
    <meta name="viewport" display="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" display="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../../ht-css/Project.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title></title>
</head>
<body>
<form class="ml-20 mt-20 mb-20 mr-20" id="form-member-add">

    <div style="text-align: center">
        <span>请选择日期</span>
        <input type="text" class="input-text Wdate radius" style="width: 222px;height: 35px;" id="logmin" readonly placeholder="请选择时间">
    </div>
    <div style="text-align: center;display: none" id="shijian">
        <span>请选择时间</span>
        <select class="select" name="brandclass" id="times" size="1" style="width: 221px;margin-top: 40px;height: 35px;">
            <option value="">请选择时间段</option>
            <option value="1">00:00~03:00</option>
            <option value="2">08:00~12:00</option>
            <option value="3">12:00~17:00</option>
            <option value="4">17:00~23:59</option>
            <option value="5">08:00~17:00</option>
        </select>
    </div>
    <div style="text-align: center;margin-top: 280px">
        <a onclick="cancelBtn()" id="cancelBtn" class="btn btn-secondary radius size-S ml-20">取消</a>
        <a onclick="estimateadd()" id="sureBtn" class="btn btn-secondary radius size-S ml-20">确认</a>
    </div>
</form>
</body>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script src="../../../ht-js/frame/doT.min.js?rev=@@hash"></script>
<script src="../../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../../ht-js/Project.js?rev=@@hash"></script>
<link type="text/css" rel="stylesheet" href="../../../ht-js/operation-js/time-js/jedate.css">
<script type="text/javascript" src="../../../ht-js/operation-js/time-js/jquery.jedate.js?rev=@@hash"></script>
<script>
    //取消
    function cancelBtn() {
        parent.layer.closeAll();
    }
    //时间
    var  d = new Date();
    var YMDHMS = d.getFullYear() + "-" +(d.getMonth()+1) + "-" + d.getDate() + " " +
        d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
    var start = {
        format: 'YYYY-MM-DD',
        minDate: YMDHMS,
        // maxDate: "2018-12-30 12:12"

    };
    $('#logmin').jeDate(start);
    // $('#logmax').jeDate(end);
    /*角色编辑*/
    function roles_edit(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    $.validator.addMethod("titleCheck", function(value, element) {
        var tel = /^.{1,40}$/;
        return this.optional(element) || (tel.test(value));
    }, "输入有误");
    $.validator.addMethod("colorCheck", function(value, element) {
        var tel = /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/;
        return this.optional(element) || (tel.test(value));
    }, "请按色值格式输入");
    
    var orders=sessionStorage.getItem("orderIds")

    var senttype =sessionStorage.getItem("wuliu")
    if(senttype==40){
        $("#shijian").css({
            display: "block"
        })
    }

    function estimateadd() {
        /*if($("#logmin").val()==""){
            $.Huimodalalert('请选择时间！',2000);
            return false;
        }
*/
        var mayarrivedin=""
        var mayarrivedinStart=""
        console.log(senttype)
        if(senttype==40){
            if($("#logmin").val()==""){
                $.Huimodalalert('请选择日期！',2000);
                return false;
            }
            if($("#times").val()==""){
                $.Huimodalalert('请选择时间段！',2000);
                return false;
            }
            console.log($("#times").html())
            var startTime=""

            var teimss=""
            if($("#times").val()==1){
                startTime="00:00:00"
                teimss="03:00:00"
            }else if($("#times").val()==2){
                startTime="08:00:00"
                teimss="12:00:00"
            }else if($("#times").val()==3){
                startTime="12:00:00"
                teimss="17:00:00"
            }else if($("#times").val()==4){
                startTime="17:00:00"
                teimss="23:59:00"
            }else if($("#times").val()==5){
                startTime="08:00:00"
                teimss="17:00:00"
            }
            mayarrivedinStart=$("#logmin").val()+' '+startTime
            mayarrivedin=$("#logmin").val()+' '+teimss
        }else {
            if($("#logmin").val()==""){
                $.Huimodalalert('请选择日期！',2000);
                return false;
            }
            mayarrivedinStart=$("#logmin").val()+' '+"00:00:00"
            mayarrivedin=$("#logmin").val()+' '+"23:59:59"
        }

        $.ajax({
            contentType: "application/json",
            type: "POST",
            url: 'https://'+ window.location.host +'/api/admin/apreorder/order/updatePreOrder',
            cache: false, //禁用缓存
            dataType: "json",
            data: JSON.stringify({
                "orderId":orders,
                // "mayArrivedIn":$("#logmin").val(),
                "mayarrivedinStart":mayarrivedinStart,
                "mayArrivedIn":mayarrivedin,
                "sentType":"",
                "actualShippingFee":"",
                "operateUserId": JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.user_ID,
                "operateUserName":JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.name,
            }),
            success: function(result) {
                if(result.errorCode==0){
                layer.msg('修改成功', {
                    icon: 6,
                    time: 1000
                }, function() {
                    var index = parent.location.reload();
                    parent.layer.close(index);
                });
                }else {
                    $.Huimodalalert(result.msg,2000);
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest);
            }
        });
    }
    
    
    
    
</script>
<style>
    .error{
        color:#ff1b1b;
    }
    label.error {
        width: 75px;
        position: absolute;
        left: 325px;
        top: 1px;
        color: #ef392b;
        font-size: 12px;
    }
    label#logmin-error{
        left:265px;
    }
</style>
</body>
</html>